# -*- coding: utf-8 -*-
# @Time : 2024/3/7 17:03
# @Author : ZH
# @File : 47.py
# @Software: PyCharm
class Solution(object):
    def permuteUnique(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """

        def sss(path, used):
            if len(path) == len(nums):
                end_data.append(list(path))
            for i in range(len(nums)):
                if used[i]:
                    continue
                path.append(nums[i])
                used[i] = True
                sss(path, used)
                path.pop()
                used[i] = False

        end_data = []
        sss([], [False]*len(nums))
        import json
        return list({json.dumps(i): i for i in end_data}.values())

if __name__ == '__main__':
    so = Solution()
    z = so.permuteUnique(nums=[1,1,2])
    print(z)

